<?php
session_start();
require_once("../include/db.php");
require_once("member.common.php");
require_once("../include/head.php");
?>
<?php $xajax->printJavascript("/");
?>
<script language="javascript">
		function unwannamail()
		{
			xajax.$('submit').disabled=true;
			var mailing=document.getElementsByName('mailing');
			for (var i=0;i<mailing.length;i++)
			{
				if (mailing[i].checked)
				{
			     xajax_unwannamail(mailing[i].value);
				}
			}
			return false;
		}
</script>		
<DIV id=gNavBottom>
<DIV id=searchDiv>
<FORM id=searchForm name=searchForm action=result.php method="post">
	<INPUT class=searchField type="text" tabIndex=10000 maxLength=128 name=search_query> &nbsp; 
    <INPUT type=submit value=Search name=search>
</FORM>
</DIV>
</DIV>
<table width="100%">
    <tr>
    	<td width="15%" valign="top">
    	  <p>
    	  <?php
    	  echo "Welcome,".$_SESSION["name"];
    	  ?>
    	  </p>    	
          My account option
          <UL>
           <li><a href="mailinglist.php">My maillist</a></li>
          </UL>    		
   	  </td>    
    	<td width="85%">
    		<h1>My mailing list</h1>
    		<hr> 	  	 <table width="100%">
   	  	 	<tr>
   	  	 		<td><b>Name</b>
   	  	 		</td>
   	  	 		<td><b>From Email</b>
   	  	 		</td>
   	  	 		<td><b>introduction</b>
   	  	 		</td>
   	  	 	</tr>
   	  	 	<?php
   	  	 	$sql="select mailing.* from mailing,membermailing,member where membermailing.memberid=member.id and membermailing.mailingid=mailing.id and member.username='".$_SESSION["name"]."'";
   	  	 	$conn = getconnection();
   	  	 	$result=mysql_query($sql,$conn);
   	  	 	while   ($row=mysql_fetch_array($result))
   	  	 	{
   	  	 		echo "<tr>\r\n";
   	  	 		echo "<td>\r\n";
   	  	 		echo "<input type='checkbox' name='mailing' value='".$row['id']."'/>".$row['name']."\r\n";
   	  	 		echo "</td>\r\n";
   	  	 		echo "<td>".$row['fromemail']."</td>\r\n";
   	  	 		echo "<td>".$row['introduction']."</td>\r\n";
   	  	 		echo "</tr>\r\n";
   	  	 	}
   	  	 	mysql_close($conn);
   	  	 	?>
   	  	<tr> 	
   	  		<td colspan="3">
       	      <input type='button' name='submit' value='UmWannamail' onclick="unwannamail();" />
   	  		</td>
   	  	</tr>
   	  	</table>
   	    </td>    
    </tr>
  </table>
<?php
require("../include/foot.php");
?>